<!DOCTYPE html>
<html>
<head>
	<title>文章详情</title>
	<meta charset="utf-8">
	<meta name="mobile-web-app-capable" content="yes">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="apple-mobile-web-app-status-bar-style" content="default">
    <meta name="viewport" content="user-scalable=no,width=device-width,initial-scale=1,maximum-scale=1">
	<link rel="stylesheet" type="text/css" href="css/style.css">
	<link rel="stylesheet" type="text/css" href="css/article.css">
	<script src="./js/jquery-1.12.4.min.js"></script>
</head>
<body>
<?php include_once('config/header.php'); ?>

<div class="advertisement" style="">
	<div class="advert-tit">
		<div class="title" id="content_title"></div>
		<div class="gather"><div id="author"></div> &nbsp;&nbsp;<p><div id="release_time"></div>&nbsp;&nbsp; </p> &nbsp;&nbsp; <div id="source"></div> <img src="./images/eye.png"> &nbsp;<p id="look"></p></div>
	</div>
</div>
<div class="content">
	<div class="con-left">
		<div class="text" id="content">
			
		</div>
		<div class="label">
			<b>文章标签： </b><div id="content_label"></div>
		</div>
		<div class="textnav">
			<div class="left">
				<a href=""><img src="./images/zan.png"></a><p>&nbsp;&nbsp;点赞&nbsp;<div id="like"></div>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</p>
				<!-- <a href="">$319.54&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</p> -->
				<a href=""><img src="./images/diss.png"></a><p>&nbsp;&nbsp;评论&nbsp;<div id="comments"></div>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</p>
			</div>
			<div class="right">
				下一篇： <a href="">IBM联合哥伦比亚大学推出区块链加速器...</a>
			</div>
		</div>
		<div class="recommend">
			<div class="title">
				<img src="./images/yuanzhu.png">
				<p>推荐资讯</p>
			</div>
			<div class="con" id="hot-news">
			</div>
		</div>
		<div class="discuss">
			<div class="title-name"><span>评论</span></div>
			<div class="comment">
				<div class="please-login"><a href="">登陆</a>账号发表你的看法，还没有账号？立即免费<a href="">注册</a></div>
				<div class="sofa">
					<img src="./images/2018112000202162141.png" class="head-pic">
					<div class="comment-con">
						<div class="member"><p>区块链在哪儿</p><span>2018-07-30</span></div>
						<div class="text">AI潮的时候，也听到过类似的声音，希望区块链更接近</div>
						<div class="interact"><img src="./images/zan.png">点赞 4031 <img src="./images/diss.png">评论 4031 <img src="./images/cai.png">踩 4031</div>
					</div>
				</div>
				<div class="sofa">
					<img src="./images/2018112000202162141.png" class="head-pic">
					<div class="comment-con">
						<div class="member"><p>区块链在哪儿</p><span>2018-07-30</span></div>
						<div class="text">AI潮的时候，也听到过类似的声音，希望区块链更接近</div>
						<div class="interact"><img src="./images/zan.png">点赞 4031 <img src="./images/diss.png">评论 4031 <img src="./images/cai.png">踩 4031</div>
						<div class="diss">
							<img src="./images/2018112000202162141.png" class="head-pic2">
							<div class="comment-con2">
								<div class="member2">
									<div class="top_member"><p>区块链在哪儿: </p><span>AI潮的时候，也听到过... </span><img src="./images/huifu.png"></div>
									<div class="time">2018-07-30</div></div>
								<div class="text2"><p>用户25123：</p><span>楼主说的对，楼主非常有见解</span></div>
								<div class="interact2"><img src="./images/zan.png"><p>点赞 4031</p> <img src="./images/diss.png"><p>评论 4031</p> <img src="./images/cai.png"><p>踩 4031</p></div>
								<div class="member3">
									<p>用户39568：</p>
									<span>随便一打，就是15个字</span>
									<div class="time2">2018-07-30</div>
								</div>
							</div>
						</div>
					</div>
				</div>
			</div>
		</div>
	</div>
	<div class="con-right">
		<div class="special">
			<div class="box-1">
				<div class="title">
					<div class="img">
						<img src="./images/yuanzhu.png">
					</div>
					<div class="tit1">专栏作者</div>
					<a href="column.php">更多 <img src="./images/youjt.png"></a>
				</div>
				<div class="writer">
					<div class="writer-head">
						<a href="author.php" id="author_id"><img src="./images/201811191520442367-380x228.png"></a>
						<div class="memberinfo">
							<p id="member_name"></p>
							<span>文章数 <b id="member_consult"></b> 浏览量 <b id="member_browse"></b></span>
						</div>
						<a href="" class="gz">关注</a>
					</div>
					<div class="writer-essay">
						<ul id="member_article">
						</ul>
					</div>
				</div>
				<div class="more">
					<a href="author.php" id="author_id">更多文章 <img src=""></a>
				</div>
			</div>
		</div>
		<?php include_once('config/ranking2.php'); ?>
	</div>
</div>

<?php include_once('config/footer.php'); ?>
</body>
<script type="text/javascript" src="../public/lib/layer/2.4/layer.js"></script>
<script type="text/javascript">
$(function(){
	var id = getUrlParam('id');
	var content_url = 'http://'+document.domain+"/index/data/content";
	$.ajax({
		type: 'POST',
        url: content_url,
        data:{id:id},
        dataType: 'json',
        success: function(result){
        	$('#content').html(result['content']);
        	$('#author').html(result['member_name']);
        	$('#release_time').html(timestampToTime(result['addtime']));
        	$('#like').html(result['like']);
        	var label = '';
        	result['label_v'].forEach((item,i)=>{
				label += '<a href="">'+result['label_v'][i]['name']+'</a>';
			})
			$('#content_label').html(label);
			$('#comments').html(result['comments']);
			$('#look').html(result['look']);
			$('#content_title').html(result['title']);
			$('#member_name').html(result['member_name']);
			$('#member_consult').html(result['member']['consult']);
			$('#member_browse').html(result['member']['browse']);
			var article_list = '';
			result['member']['list'].forEach((item,i)=>{
				article_list += '<a href="article.php?id='+result['member']['list'][i]['id']+'"><li><img src="./images/dian.png">'+result['member']['list'][i]['title']+'</li></a>';
			})
			var author_url = $('#author_id').attr('href');
			author_url = author_url+'?id='+result['user_id'];
			$('#author_id').attr('href',author_url);
			$('#member_article').html(article_list);
        },
	})
	var hot_new_url = 'http://'+document.domain+"/index/data/hot_new";
	//首页推荐文章
	$.ajax({
		type: 'POST',
        url: hot_new_url,
        data:{},
        dataType: 'json',
        success: function(result){
        	var html = '';
			result.forEach((item,i)=>{
				html += '<div class="text-con">';
					html += '<img src="'+result[i]['img']+'" class="img">';
					html += '<div class="text-name">'+result[i]['title']+'</div>';
					html += '<p><img src="./images/zan.png"> '+result[i]['like']+' &nbsp;&nbsp;<img src="./images/diss.png"> '+result[i]['comments']+'</p>';
					html += '</div>';
				html += '</div>';
			})
			$('#hot-news').html(html);
        },
	})
})
function getUrlParam(name) {
    var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)"); //构造一个含有目标参数的正则表达式对象
    var r = window.location.search.substr(1).match(reg);  //匹配目标参数
    if (r != null) return unescape(r[2]); return null; //返回参数值
}
function timestampToTime(timestamp) {
    var date = new Date(timestamp * 1000);//时间戳为10位需*1000，时间戳为13位的话不需乘1000
    var Y = date.getFullYear() + '-';
    var M = (date.getMonth()+1 < 10 ? '0'+(date.getMonth()+1) : date.getMonth()+1) + '-';
    var D = date.getDate() + ' ';
    var h = date.getHours() + ':';
    var m = date.getMinutes() + ':';
    var s = date.getSeconds();
    return Y+M+D+h+m+s;
}
</script>
</html>